﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//using Chefbook.DataObjects;
using System.Globalization;
using Chefbook.DataAccessLayer;

namespace Chefbook.UserActions
{
    public class CreateRecipeAction : UserActionBase
    {
        private Category parent;
        private Recipe recipe;
        public CreateRecipeAction(Category parent)
        {
            this.parent = parent;
        }

        public override void DoAction()
        {
            base.DoAction();
            recipe = new Recipe();
            parent.AddRecipe(recipe);
        }

        public override void UndoAction()
        {
            base.UndoAction();
            DatabaseConnector.DeleteObject(recipe);
        }

        public override string ToString()
        {
            return string.Format(CultureInfo.CurrentUICulture, "Create new Recipe in Category '{0}'", parent);
        }
    }
}
